package cn.yfxu.server.pojo;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* @author Xxxxyf
* @date 2021/3/4
* @desc 公共返回对象
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="Result对象", description="")
public class Result implements Serializable {
    private long code;
    private String Message;
    private Object obj;
    //成功返回结果
    public static Result success(String message){
        return new Result(200,message,null);
    }
    //成功返回结果
    public static Result success(String message,Object obj){
        return new Result(200,message,obj);
    }
    //失败返回结果
    public static Result error(String message){
        return new Result(500,message,null);
    }
    //失败返回结果
    public static Result error(String message,Object obj){
        return new Result(500,message,obj);
    }
}
